<template>
  <j-modal :title="title" :width="500" :visible="visible" switchFullscreen @cancel="handleCancel" @ok="handleOk">
    <div class="content">
      <depart-tree :departType="2" :rootOpened="true" :multi="true" @ok="getTreeData" @toggleBool="toggleBool" />
    </div>
  </j-modal>
</template>

<script>
import DepartTree from '@/views/sjsk/modules/departTree'

export default {
  name: 'selObj',
  components: {
    DepartTree,
  },
  data() {
    return {
      visible: false,
      title: null,
      toggle: true,
      checkList: [],
    }
  },
  created() {},
  mounted() {},

  methods: {
    show(_title) {
      this.title = _title
      this.visible = true
    },

    handleCancel() {
      this.visible = false
    },

    handleOk() {
      this.$emit('ok', this.checkList)
      this.visible = false
    },

    getTreeData(datas, id) {
      console.log(datas, id)
      this.checkList = datas
    },

    toggleBool(bool) {
      console.log(bool)
      this.toggle = bool
    },
  },
}
</script>

<style lang="less" scoped>
.content {
  height: 50vh;
  overflow-y: scroll;
}
</style>
